import request from '@/utils/request.js'

/**
 *
 * @param {object} data {mobile:'',code:''}
 */
export const login = data => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}

/**
 *获取短信验证码
 * @param {*} mobile
 * @returns
 */
// 发送验证码
export const sendMessage = mobile => {
  return request({
    method: 'GET',
    url: '/v1_0/sms/codes/' + mobile
  })
}
// 获取用户信息
export const getUserProfile = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user'
  })
}

// 获取用户频道列表
export const getUserChannels = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/channels'
  })
}

// 关注用户
export const addFocus = target => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: { target: target }
  })
}
// 取消关注用户
export const removeFocus = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`
  })
}
